//
//  XJ_CreditCardBindViewController.m
//  XunJieProject
//
//  Created by xue on 2018/6/26.
//  Copyright © 2018年 Soowin. All rights reserved.
//

#import "XJ_CreditCardBindViewController.h"

@interface XJ_CreditCardBindViewController ()<UIWebViewDelegate>

@end

@implementation XJ_CreditCardBindViewController
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    // 禁用返回手势
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
    
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    // 开启返回手势
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(void)backButtonClick{
    
    if ([self.nav_titleLabel.text isEqualToString:@"取现"]) {
        [self.navigationController popToRootViewControllerAnimated:YES];
    }else{
        [self.navigationController popViewControllerAnimated:YES];
    }
}
-(void)creatMainUI{
    
    self.nav_titleLabel.text =self.navTitleString;
    
    UIWebView * webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, SafeAreaTopHeight, SCREEN_WIDTH, SCREEN_HEIGHT - SafeAreaTopHeight)];
    webView.delegate =self;
    
//    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://pay.feifanzhichuang.com/quickPaymentPage/quickPay/payPage?merchantNo=B105378934&orderNum=XJ19700101080000Z2s3"]];//创建URL
    NSURL *url = [NSURL URLWithString:_urlString];//创建URL
    //创建URL
    NSURLRequest* request = [NSURLRequest requestWithURL:url];//创建NSURLRequest
    [webView loadRequest:request];
    [self.view addSubview:webView];
}

//开始加载网页
- (void)webViewDidStartLoad:(UIWebView *)webView{
    
    
}
//网页加载完成
- (void)webViewDidFinishLoad:(UIWebView *)webView{
    
}
//网页加载错误
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
    
    NSData * data = error.userInfo[@"com.alamofire.serialization.response.error.data"];
    NSString * str = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
    NSLog(@"服务器的错误原因:%@",str);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
